from common.core.analsys import analysis_case
from common.core.request import RequestCase

from common.utils.parser import YamlLoader, get_case_path
import pytest
import allure


class Test:
    @pytest.mark.parametrize("case", YamlLoader(get_case_path(__file__)).load_cases())
    def test_(self, case):
        origin_case = RequestCase(case)
        if origin_case.skip:  # 跳过
            pytest.skip()
        arg = analysis_case(__file__, origin_case, )  # 执行依赖用例并返回解析后的用例本身
        obj = RequestCase(arg)
        allure.dynamic.story(obj.story)
        allure.dynamic.title(obj.title)
        allure.dynamic.description(obj.description)
        obj.do_request().assert_res()
